public class MyTest2 {

    public static void main(String[] args) {
        System.out.println("main方法执行");
        StringBuilder stringBuilder = test1();
        System.out.println("stringBuilder = " + stringBuilder);

        try {
            test2();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }

    }
    public static StringBuilder test1(){
        StringBuilder stringBuilder = new StringBuilder();
        try {
            Class.forName("com.mysql.jdbc.Driver");
            stringBuilder.append("hhh");

        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }finally {
            stringBuilder.append("www");
        }
        return stringBuilder;
    }
    public static void test2() throws ClassNotFoundException {
        Class.forName("com.mysql.jdbc.Driver");
        try {
            throw new Exception("nullException");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
